import urllib.request

# 判断response返回类型
response = urllib.request.urlopen('https://httpbin.org')
print(type(response))  # 返回的http.client.HTTPResponse包含两个参数(状态码,响应头)
print(response.status)  # 获得状态码200
print(response.getheaders())  # 获得响应头
print(response.getheader('Server'))  # 获得响应头里的Server


